<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('编辑用印信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-add" th:object="${vo}">
            <input id="caseId" name="chopId" type="hidden" th:field="*{chopId}"/>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">用印名称：</label>
                <div class="col-sm-8">
                    <input class="form-control" type="text" th:field="*{chopName}" required>
                </div>
            </div>
            
            <div class="form-group">
	            <div id="element_ct">
            		<label class="col-sm-3 control-label is-required">印章类型：</label>
                       <div class="col-sm-2">
                         <select class="type form-control m-b" th:field="*{chopGroup}" required data-first-title="请选择">
		                  	<option value="">请选择</option>
		                  	<option th:value="*{chopGroup}" th:selected="1"></option>
		                </select>
	                </div>
		            <label class="col-sm-3 control-label is-required">申请类型：</label>
		            <div class="col-sm-2">
		                <select class="router form-control m-b" th:field="*{chopTypeId}" required data-first-title="请选择">
		                  <option value="">请选择</option>
		                  <option th:value="*{chopTypeId}" th:selected="1"></option>
		                </select>
		           </div>
	            </div>
            </div>
            
            <div class="form-group">
	            <div>
            		<label class="col-sm-3 control-label is-required">何种印章：</label>
	                <div class="col-sm-2">
			 			<select class="form-control m-b" th:field="*{sealTypeId}" required>
			            <option value="">请选择</option>
				 		<option th:each="u : ${sealTypes}" th:text="${u.name}" th:value="${u.id}" th:field="*{sealTypeId}"></option>
						</select>
	               </div>
		           <label class="col-sm-3 control-label is-required">文件份数：</label>
		           <div class="col-sm-2">
		              <input type="text" class="router form-control m-b" th:field="*{copies}" required>
		           </div>
	            </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">用印状态：</label>
                    <div id="element_ct" class="row">
                        <div class="col-sm-2">
			             	<select class="form-control m-b" th:field="*{status}" disabled="true" required>
			                    <option value="">请选择</option>
				      			<option th:each="u : ${chopStatus}" th:text="${u.name}" th:value="${u.id}" th:field="*{status}"></option>
				   			</select>
		                </div>
                	</div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text" th:field="*{remark}">
                </div>
            </div>
        </form>
        
	    <div class="form-horizontal m" id="div-info-add" readonly th:if="${#lists.isEmpty(vo.files)}">
	        <div class="form-group">
	            <label class="col-sm-3 control-label">用印文件:</label>
	            <!-- 用印文件 -->
	            <div id="element_chop_files" class="row">                                                                                                                                     
	                <div class="col-sm-8">
	                	无
	                </div>
	            </div>
			</div>
		</div>
        
	     <div class="form-horizontal m" id="div-info-add" readonly th:unless="${#lists.isEmpty(vo.files)}">
	        <div class="form-group">
	            <label class="col-sm-3 control-label">用印文件:</label>
	            <!-- 用印文件 -->
	            <div id="element_chop_files" class="row">                                                                                                                                     
	                <div class="col-sm-8">
		            	<table>
					    <thead>
					    <tr>
					        <th width="2%">No.</th>
					        <th width="48%">文件名</th>
					        <th width="30%">文件状态</th>
					        <th width="20%">备注</th>
					    </tr>
					    </thead>
		            	<tbody>
 				          <tr th:each="file, fileStat:${vo.files}">
				            <td>[[${fileStat.index+1}]].&nbsp;</td>
				            <td>[[${file.name}]]</td>
				            <td>
				              &nbsp;&nbsp;
				              <a name="btn_download"
				                th:href="@{'/office/chopinfo/enroll/download/' + ${vo.chopId} + '/' + ${file.name}}">下载</a>
				            </td>
				          </tr>
				     </tbody>
		             </table>
					</div>
	          	</div>
	        </div>
	     </div>

    </div>
    <!-- [[${vo.chopId}]]/[[${vo.status}]] -->
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jquery-cxselect-js" />
    
	<script type="text/javascript">
	window.onload=function () {
		$('#form-info-add').find('input').attr('readonly',true);
		$('#form-info-add').find('radio').attr('readonly',true);
		$('#form-info-add').find('select').attr('readonly',true);
		$('#form-info-add').find('select').attr('disabled',true);
		$('#form-info-add').find('button').attr('readonly',true);
		$('#form-info-add').find('button').attr('disabled',true);
	}
	</script>
           
    <script th:inline="javascript">
        var prefix = ctx + "office/chopinfo/record"
        $("#form-info-add").validate({
            focusCleanup: true
        });

   </script>
   
	<script th:inline="javascript">
		// 直接返回获取
		var ctData = [[${ctData}]];
		$('#element_ct').cxSelect({
		  selects: ['type', 'router'],
		  jsonValue: 'v',
		  data: ctData
		});
	</script>
    
</body>
</html>